/**
 * 如何判定,前端传过来自由参数,后端不一一对应也可以
 * @param { x, y } param0 
 * @param {*} cb 
 *   const { x } = usePosition();
     useOverLayByWatch(x, function (value) {
      value == 0 ? (isActive.value = true) : (isActive.value = false);
     });

    const isActive = ref(false);
    useOverLayByWatch(x, function (state) {
      isActive.value = state;
    });
 */
// export function useOverLayByWatch(x, cb) {
//   watch(x, (nv, ov) => {
//     if (nv == 0) {
//       cb(true)
//     } else {
//       cb(false)
//     }
//   });
// }
const { watch, ref } = Vue;
export function useOverLayByWatch(x) {
  let state = false
  !function () {
    watch(x, (nv, ov) => {
      if (nv === 0) {
        state = true
      } else {
        state = false
      }
    });
  }
  console.log(state);
  return state
}
const { computed } = Vue
export function useOverLayByComputed(x) {
  return computed(() => x.value === 0 ? true : false)
}